from typing import Dict, Any, Optional
from .vllm_backend import VLLMBackend
from .sglang_backend import SGLangBackend
from .transformers_backend import TransformersBackend


class BackendManager:
    """Manages different inference backends."""
    
    def __init__(self):
        self.backends: Dict[str, Any] = {
            "vllm": VLLMBackend(),
            "sglang": SGLangBackend(),
            "transformers": TransformersBackend()
        }
        
    def get_backend(self, backend_name: str):
        """Get a backend by name."""
        if backend_name not in self.backends:
            raise ValueError(f"Unsupported backend: {backend_name}. Available: {list(self.backends.keys())}")
        return self.backends[backend_name]